home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / filesize.cpp < prev    next >
C/C++ Source or Header  |  1990-07-23  |  267b  |  17 lines

  1. /* FILESIZE.C - get and return filesize.
  2.  */
  3. #include <stdlib.h>
  4. #include <sys\stat.h>
  5.  
  6. long filesize ( char *spec )
  7.     {
  8.     long l;
  9.     struct stat st;
  10.     
  11.     l = stat ( spec, &st );
  12.     if ( l != -1 )
  13.         {
  14.         l = st.st_size; 
  15.         } 
  16.     return (l);        /* filesize () */
  17.     }